package lab.dexter.bbsreader;

import lab.dexter.bbsreader.managers.BoardPostsManager;
import lab.dexter.bbsreader.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class GotoBoard extends Activity {
	private EditText mBoardname;
	private Button mButton;
	private Context mContext;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.goto_board);
		
		mContext = this.getApplicationContext();
		
		mBoardname = (EditText)findViewById(R.id.board_name);
		mButton = (Button)findViewById(R.id.goto_submit);
		
		mButton.setOnClickListener(new OnClickListener(){

			public void onClick(View v) {
				String boardName = mBoardname.getText().toString();
				Intent intent = new Intent(mContext, ListBrowser.class);
				intent.putExtra(ListBrowser.MGR, ListBrowser.MGR_BOARD_POSTS);
				intent.putExtra(BoardPostsManager.PARAM_BOARD, boardName);
				intent.putExtra(BoardPostsManager.PARAM_VIEW_MODE, BoardPostsManager.PARAM_VIEW_MODE_NORMAL);
				startActivity(intent);
			}

		});
	}
}
